package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyProjectUpdateArrearageLinkageDTO;
import com.itlong.cloud.POJO.VO.property.*;
import com.itlong.cloud.project.property.IPropertyArrearageLinkageServiceClient;
import com.itlong.cloud.property.service.IPropertyArrearageLinkageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <desc>
 *    物业欠费联动服务暴露接口实现类.
 * </desc>
 *
 * @createDate 2019-01-22
 */
@RestController
public class PropertyArrearageLinkageServiceResource implements IPropertyArrearageLinkageServiceClient {

    @Autowired
    IPropertyArrearageLinkageService iPropertyArrearageLinkageService;

    /**
     * <desc>
     *    获取欠费联动设置信息
     * <desc/>
     *
     * @param  projectId  项目编号
     * @return  PropertyArrearageLinkageVO 欠费联动信息
     * @author Qiang.S
     * @createDate 2019/01/22
     */
    @Override
    @RequestMapping(path = "/arrearage/linkage/getArrearageLinkageInfo",method = {RequestMethod.POST})
    public PropertyArrearageLinkageVO getArrearageLinkageInfo(@RequestParam("projectId") String projectId) throws Exception{
        return iPropertyArrearageLinkageService.getArrearageLinkageInfo(projectId);
    }

    /**
     * <desc>
     *      更新欠费联动信息
     * <desc/>
     *
     * @param dto 欠费联动信息
     * @return 受影响的行数
     * @author Qiang.S
     * @createDate 2019/01/22
     */
    @Override
    @RequestMapping(path = "/arrearage/linkage/updateArrearageLinkageInfo",method = {RequestMethod.POST})
    public PropertyArrearageLinkageVO updateArrearageLinkageInfo(@RequestBody PropertyProjectUpdateArrearageLinkageDTO dto) throws Exception{
        return iPropertyArrearageLinkageService.updateArrearageLinkageInfo(dto);
    }

    /**
     * <desc>
     *      更新欠费联动信息
     * <desc/>
     *
     * @param projectId 项目编号
     * @return 欠费者电话号
     * @author Qiang.S
     * @createDate 2019/01/22
     */
    @Override
    @RequestMapping(path = "/arrearage/linkage/getArrearagePhoneNum",method = {RequestMethod.POST})
    public List<String> getArrearagePhoneNum(@RequestParam("projectId") String projectId) throws Exception{
        return iPropertyArrearageLinkageService.getArrearagePhoneNum(projectId);
    }

}
